package com.cloud.system.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cloud.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Size;

/**
 * 字典数据表 sys_dict_data
 *
 * @author zx
 */
@Data
@Schema(name = "字典数据", description = "系统管理")
@TableName("sys_dict_data")
public class SysDictData extends BaseEntity {

    @TableId(value = "dict_code", type = IdType.AUTO)
    @Excel(name = "字典编码", orderNum = "1", width = 15)
    private Long dictCode;

    @Schema(description = "字典排序")
    @Excel(name = "字典排序", orderNum = "2", width = 10)
    private Long dictSort;

    @Schema(description = "字典标签")
    @Excel(name = "字典标签", orderNum = "3", width = 15)
    private String dictLabel;

    @Schema(description = "字典键值")
    @Excel(name = "字典键值", orderNum = "4", width = 15)
    private String dictValue;

    @Schema(description = "字典类型")
    @Excel(name = "字典类型", orderNum = "5", width = 15)
    private String dictType;

    @Schema(description = "样式属性")
    @Excel(name = "样式属性", orderNum = "6", width = 20)
    private String cssClass;

    @Schema(description = "表格字典")
    @Excel(name = "表格字典", orderNum = "7", width = 15)
    private String listClass;

    @Schema(description = "是否默认（Y是 N否）")
    @Excel(name = "是否默认", orderNum = "8", width = 10, replace = {"是_Y", "否_N"})
    private String isDefault;

    @Schema(description = "状态（0正常 1停用）")
    @Excel(name = "状态", orderNum = "9", width = 10, replace = {"正常_0", "停用_1"})
    private Integer status;

    @Schema(description = "备注")
    @Excel(name = "备注", orderNum = "10", width = 20)
    private String remark;

    @NotBlank(message = "字典标签不能为空")
    @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
    public String getDictLabel() {
        return dictLabel;
    }

    @NotBlank(message = "字典键值不能为空")
    @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
    public String getDictValue() {
        return dictValue;
    }

    @NotBlank(message = "字典类型不能为空")
    @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
    public String getDictType() {
        return dictType;
    }

    @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
    public String getCssClass() {
        return cssClass;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("dictCode", getDictCode())
                .append("dictSort", getDictSort())
                .append("dictLabel", getDictLabel())
                .append("dictValue", getDictValue())
                .append("dictType", getDictType())
                .append("cssClass", getCssClass())
                .append("listClass", getListClass())
                .append("isDefault", getIsDefault())
                .append("status", getStatus())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
